<template>
  <div class="manual-upload">
    <LicenseInfo v-if="hasLicense" :source="1" />

    <div v-else class="upload">
      <i-icons-no-cert :size="20" />
      <span class="text-3"
        >当前无证书，您可以
        <span class="text-primary cursor-pointer hover:" @click="openUpload">
          上传证书
        </span>
      </span>
    </div>
  </div>
</template>
<script setup lang="ts">
import LicenseInfo from './LicenseInfo.vue'

const licenseInfo = inject(licenseInfoKey)
const openUpload = inject(uploadLicenseKey)
const hasLicense = computed(() => {
  const cert_id = Number(licenseInfo?.value?.site_cert?.manual_cert_id)
  return cert_id && cert_id !== 0
})
</script>
<style lang="less" scoped>
.manual-upload {
  width: 100%;

  .upload {
    border: 1px dashed var(--color-border-4);
    @apply flex flex-col justify-center
      items-center p-4 gap-y-2 rounded-2;
  }
}
</style>
